package com.ruoyi.xjt.service;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.xjt.service.factory.XjtUserServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 用户服务
 * 
 * @author ruoyi
 */
@Service
@FeignClient(contextId = "xjtUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = XjtUserServiceFallbackFactory.class)
public interface XjtUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/user/info/{username}")
    public R<Map<String,Object>> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息
     *
     * @param sysUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/user/register")
    public R<Boolean> registerUserInfo(@RequestBody Map<String,Object> sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
